package com.xqboss.apps.convert.user;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.xqboss.apps.enums.nft.UserNftStatusEnum;
import com.alibaba.excel.enums.CellDataTypeEnum;

/**
 * @author Administrator
 */
public class ExportUserNftStatusEnumConverter  implements Converter<UserNftStatusEnum> {

    @Override
    public Class supportJavaTypeKey() {
        return UserNftStatusEnum.class;
    }

    @Override
    public WriteCellData<?> convertToExcelData(UserNftStatusEnum value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(value.getMsg());
    }

    @Override
    public UserNftStatusEnum convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return UserNftStatusEnum.valueOf(cellData.getStringValue());
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }
}
